package com.inke.box.login;


import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;

import com.blankj.utilcode.util.ToastUtils;
import com.bumptech.glide.Glide;
import com.inke.box.R;
import com.inke.box.inkemain.InkeMainActivity;
import com.inke.box.login.vo.InKe_User;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import mvp.MVPBaseActivity;


/**
 * MVPPlugin
 *  邮箱 784787081@qq.com
 */

public class LoginActivity extends MVPBaseActivity<LoginContract.View, LoginPresenter> implements LoginContract.View {

    @BindView(R.id.iv)ImageView iv;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login_activity);
        ButterKnife.bind(this);

//        Glide.with(this).load("https://gss2.bdstatic.com/-fo3dSag_xI4khGkpoWK1HF6hhy/baike/c0%3Dbaike116%2C5%2C5%2C116%2C38/sign=80a0e826da160924c828aa49b56e5e9f/f636afc379310a5585445184bd4543a982261059.jpg").into(iv);

    }

    @OnClick({R.id.login_btn})
    public void onClick(View view){
        switch (view.getId()){
            case R.id.login_btn://登录
                //登录网络请求
//                mPresenter.login("jie","1234");

                startActivity(new Intent(LoginActivity.this, InkeMainActivity.class));


                break;
//            case R.id.login_btn_cancle://取消网络登录任务
//                mPresenter.cancleLogin();
//                break;
        }
    }

    @Override
    public void loginSucceed(InKe_User user) {
        ToastUtils.showShort("登录成功");
    }

    @Override
    public void loginErr(String message) {
        ToastUtils.showShort(message);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        //取消网络登录任务
        //mPresenter.cancleLogin();
    }
}
